//package com.dc.dbus.register;
//
//import java.util.Arrays;
//import java.util.concurrent.TimeUnit;
//
//public class ZookeeperServiceRegister_Client_1 {
//	
//	public static void main(String[] args) throws Exception {
//		
//		System.out.println("Client_1---------------");
//		
//		ZookeeperServiceRegister register5 = new ZookeeperServiceRegister("127.0.0.1:2181");
//		register5.registerServiceListener(Arrays.asList(new String[]{"UserService", "MsgService"}),
//				new ServiceChangeListener() {
//			@Override
//			public void serviceDisconected(String serviceName, String node) {
//				System.out.println("serviceDisconected: " + serviceName + "->" + node);
//			}
//			@Override
//			public void serviceActive(String serviceName, String node, String[] routers, String[] hosts, int[] ports) {
//				StringBuilder serviceId = new StringBuilder();
//				for (int i=0; ; ) {
//					serviceId.append(hosts[i]).append(":").append(ports[i]);
//					
//					i++;
//					if (i == hosts.length) {
//						break;
//					} else {
//						serviceId.append(",");
//					}
//				}
//				System.out.println("serviceActive: " + serviceName + "->" + node + ": " + serviceId);
//			}
//			@Override
//			public void serviceChange(String serviceName, String node, String[] routers, String[] hosts, int[] ports) {
//				// TODO Auto-generated method stub
//				
//			}
//		});
//		
//		TimeUnit.SECONDS.sleep(1000);
//	}
//	
//}
//
//
